package cz.muni.fi.pa165.musiclibrary.api.database.dao;

import java.util.List;

import cz.muni.fi.pa165.musiclibrary.api.database.entity.IArtist;

/**
*
* @author Martin Majlath
* 2012-10-10T16:21:43+0200
*/
public interface IArtistDAO {

    /**
     * Creates and add new artist entry to database
     * 
     * @throws IllegalArgumentException if:
     * <ul>
     *  <li> parameter is (@code null)
     *  <li> artist id is not (@code null)
     * </ul>
     * @param artist to be created
     */
    void create(final IArtist artist);
    
    /**
     * Edits and updates exististing artist in database
     * 
     * @throws IllegalArgumentException if:
     * <ul>
     *  <li> parameter is {@code null}
     *  <li> artist id is {@code null}
     * </ul>
     * @param artist to be updated
     */
    void update(final IArtist artist);
    
    /**
     * Deletes artist from database
     * 
     * @throws IllegalArgumentException if:
     * <ul>
     *  <li> parameter is {@code null}
     *  <li> artist id is not {@code null}
     * </ul>
     * @param artist to be deleted
     */
    void delete(final IArtist artist);
    
    /**
     * Finds and returns artist 
     * 
     * @throws IllegalArgumentException if parameter is {@code null}
     * @param idArtist id of wanted artist
     * @return artist with given id or null when artist does not exist
     */
    IArtist getById(final Long idArtist);
    
    /**
     * Returns all artist entries from database
     * 
     * @return List of all artists entries from database or empty list if there aro no entries
     */
    List<IArtist> getAll();
    
    /**
     * Returns all artists with specified name
     * 
     * @param name of wanted artist
     * @return List of artists with matching name or empty list if there are not any that matches
     */
    List<IArtist> getByName(final String name);
}
